﻿using System;
using System.Reflection;

namespace Having.Site.Data
{
    /// <summary>
    /// 使用LambdaToSqL
    /// </summary>
    public static class LambdaHelper
    {
        /// <summary>
        /// 
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="_ispara">是否参数模式</param>
        /// <param name="dbt">链接方式</param>
        /// <returns></returns>
        public static Lambda.IDataQuery<T> GetHelper<T>(SQLType dbt= SQLType.MSSQL, bool _ispara = true) where T:class,new()
        {
            Lambda.IDataQuery<T> ip = null; 
            switch (dbt)
            {
                case SQLType.MSSQL:
                    ip=new Lambda.MSSQLDataQuery<T>(_ispara);
                    break;
                case SQLType.MYSQL:
                    ip = new Lambda.MYSQLDataQuery<T>(_ispara);
                    break;
                case SQLType.SQLITE:
                    ip = new Lambda.SQLiteDataQuery<T>(_ispara);
                    break;
            }
            return ip;
        }

    }
}
